Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: more size cuts #457

Merged
merged 6 commits into from
Nov 18, 2024
Merged

refactor: more size cuts #457

merged 6 commits into from
Nov 18, 2024

Conversation

BenSparksCode
Copy link
Contributor

@BenSparksCode BenSparksCode commented Nov 18, 2024

Cuts down Atlas.sol by 238 bytes in total. Needed to squeeze in #456

Changes:

  • Made onlyWhenUnlocked an internal function instead of a modifier (cuts 40 bytes)
  • Added indexed to appropriate event fields, saves a bit of size per field (cuts 33 bytes)
  • Replaced Transfer events with Mint and Burn events (cuts 12 bytes)
  • Removed redundant uint112 overflow check, done in SafeCast on line below (cuts 40 bytes)
  • Moved SafeCast operation to inline instead of creating new stack var (cuts 8 bytes)
  • Refactored _handleErrors in Atlas.sol to save size (cuts 105 bytes)

Most of these will also save a bit of gas.

Copy link
Contributor

@jj1980a jj1980a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@BenSparksCode BenSparksCode merged commit 66c1881 into atlas-v1.1 Nov 18, 2024
2 of 3 checks passed
@BenSparksCode BenSparksCode deleted the more-size-cuts branch November 18, 2024 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants